import pandas as pd
import numpy as np
import plotly.express as px
df=pd.read_excel("fas.xlsx")
df["Publish Date"]=pd.to_datetime(df["Publish Date"], format='%Y-%m-%d')
df.head()
| Unnamed: 0 | Title | Label | Selling Prix in £ | Original Prix in £ | Discount | Link | Img | XS | S | ... | 30" | 32" | 34" | 36" | 38" | 38"W | 36"W | 30"W | 32"W | 34"W | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 'AYLA' Knitted Co ord Crop top Black - CTJ007 | No Label | 19.99 | 19.99 | 0 | https://fathersonsclothing.com/collections/all... | https://cdn.shopify.com/s/files/1/0423/8761/pr... | NaN | 0.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 1 | 1 | 'AYLA' Knitted Co ord Crop top white - CTJ009 | No Label | 19.99 | 19.99 | 0 | https://fathersonsclothing.com/collections/all... | https://cdn.shopify.com/s/files/1/0423/8761/pr... | NaN | 0.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 2 | 2 | 'AYLA' Knitted Co ord Trouser Black - CTJ008 | No Label | 29.99 | 29.99 | 0 | https://fathersonsclothing.com/collections/all... | https://cdn.shopify.com/s/files/1/0423/8761/pr... | NaN | 1.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 3 | 3 | 'AYLA' Knitted Co ord Trouser White - CTJ010 | No Label | 29.99 | 29.99 | 0 | https://fathersonsclothing.com/collections/all... | https://cdn.shopify.com/s/files/1/0423/8761/pr... | NaN | 2.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 4 | 4 | 'CASUAL CLUB' ECRU CROP JUMPER - CT092 | On sale | 29.99 | 34.99 | 14 | https://fathersonsclothing.com/collections/all... | https://cdn.shopify.com/s/files/1/0423/8761/pr... | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
5 rows × 67 columns
dd=df.groupby(["Publish Date","Label"]).agg({"# of variants":"sum","Title":"count"}).reset_index()
dd["Year"]=dd["Publish Date"].dt.year
dd["MnD"]=dd["Publish Date"].dt.strftime('%m-%d')
dd["month"]=dd["Publish Date"].dt.month
px.line(dd,x="Publish Date",y="Title",color='Label',
title='Number of products published during the years and their current labeling')
size=300
px.line(dd[(dd["Publish Date"]>"2019-01-01") & (dd["Publish Date"]<"2020-01-01")],x="Publish Date",y="Title",color='Label',
range_x=["2019-01-01","2019-12-30"],range_y=[0,12], title="2019", height=size).show()
px.line(dd[(dd["Publish Date"]>"2020-01-01") & (dd["Publish Date"]<"2021-01-01")],x="Publish Date",y="Title",color='Label',
range_x=["2020-01-01","2020-12-30"],range_y=[0,12], title="2020", height=size).show()
px.line(dd[(dd["Publish Date"]>"2021-01-01")],x="Publish Date",y="Title",color='Label',
range_x=["2021-01-01","2021-12-30"],range_y=[0,12], title="2021", height=size).show()
size=300
px.line(dd[(dd["Publish Date"]>"2019-01-01") & (dd["Publish Date"]<"2020-01-01")],x="Publish Date",y="# of variants",color='Label',
range_x=["2019-01-01","2019-12-30"],range_y=[0,120], title="2019", height=size).show()
px.line(dd[(dd["Publish Date"]>"2020-01-01") & (dd["Publish Date"]<"2021-01-01")],x="Publish Date",y="# of variants",color='Label',
range_x=["2020-01-01","2020-12-30"],range_y=[0,120], title="2020", height=size).show()
px.line(dd[(dd["Publish Date"]>"2021-01-01")],x="Publish Date",y="# of variants",color='Label',
range_x=["2021-01-01","2021-12-30"],range_y=[0,120], title="2021", height=size).show()
ddd=df[df['Label']=="On sale"]
px.box(ddd,x="Discount",hover_data=["Title","Publish Date","Selling Prix in £"],height=300)
px.box(df,x="Selling Prix in £",hover_data=["Title","Publish Date","Discount"],color='Label',height=400)
px.bar(df['Label'].value_counts().reset_index().rename(columns={"index": "Label", "Label": "count"}),x="Label",y="count")
no_lab=df[df["Label"]=='No Label'][["XS","S","S/M","M","M/L","L","XL","XXL","XXXL","XXXXL","6","8","10","12","14","16","18","Default","ONE",
"6-W24","8-W26","10-W28","12-W30","14-W32","16-W34","3 Years","4 Years","5 Years","6 Years","7 Years","8 Years",
"9 Years","10 Years","11 Years","12 Years"]].sum().reset_index().rename(columns={"index": "size", 0: "count"})
no_lab["Label"]="No Label"
on_s=df[df["Label"]=='On sale'][["XS","S","S/M","M","M/L","L","XL","XXL","XXXL","XXXXL","6","8","10","12","14","16","18","Default","ONE",
"6-W24","8-W26","10-W28","12-W30","14-W32","16-W34","3 Years","4 Years","5 Years","6 Years","7 Years","8 Years",
"9 Years","10 Years","11 Years","12 Years"]].sum().reset_index().rename(columns={"index": "size", 0: "count"})
on_s["Label"]="On sale"
df3=pd.concat([no_lab,on_s])
df3.head()
| size | count | Label | |
|---|---|---|---|
| 0 | XS | 3993.0 | No Label |
| 1 | S | 8523.0 | No Label |
| 2 | S/M | 14.0 | No Label |
| 3 | M | 11273.0 | No Label |
| 4 | M/L | 31.0 | No Label |
px.bar(df3,x="count",y="size",color="Label", barmode='group', height=800)